package net.zjitc.dao;

import net.zjitc.mapper.BillMapper;
import net.zjitc.pojo.Bill;
import net.zjitc.pojo.BillItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@Repository
public class BillDao {
    @Autowired
    private BillMapper billMapper;

    public List<Bill> findByCustomerId(Long customerId){
        return billMapper.selectBillByCustomerId(customerId);
    }

    public List<BillItem> findBillItemsByBillId(Long billId){
        return billMapper.selectBillItemsByBillId(billId);
    }

    public Bill updateBillTotalPrice(Bill bill){
        return billMapper.updateBill(bill.getTotalPrice(),bill.getId());
    }

}
